/* eslint-disable */
import _m0 from "protobufjs/minimal";

export const protobufPackage = "slash.store";

export interface ActivityShorcutCreatePayload {
  shortcutId: number;
}

export interface ActivityShorcutViewPayload {
  shortcutId: number;
  ip: string;
  referer: string;
  userAgent: string;
}

function createBaseActivityShorcutCreatePayload(): ActivityShorcutCreatePayload {
  return { shortcutId: 0 };
}

export const ActivityShorcutCreatePayload = {
  encode(message: ActivityShorcutCreatePayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    if (message.shortcutId !== 0) {
      writer.uint32(8).int32(message.shortcutId);
    }
    return writer;
  },

  decode(input: _m0.Reader | Uint8Array, length?: number): ActivityShorcutCreatePayload {
    const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseActivityShorcutCreatePayload();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 8) {
            break;
          }

          message.shortcutId = reader.int32();
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },

  create(base?: DeepPartial<ActivityShorcutCreatePayload>): ActivityShorcutCreatePayload {
    return ActivityShorcutCreatePayload.fromPartial(base ?? {});
  },

  fromPartial(object: DeepPartial<ActivityShorcutCreatePayload>): ActivityShorcutCreatePayload {
    const message = createBaseActivityShorcutCreatePayload();
    message.shortcutId = object.shortcutId ?? 0;
    return message;
  },
};

function createBaseActivityShorcutViewPayload(): ActivityShorcutViewPayload {
  return { shortcutId: 0, ip: "", referer: "", userAgent: "" };
}

export const ActivityShorcutViewPayload = {
  encode(message: ActivityShorcutViewPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    if (message.shortcutId !== 0) {
      writer.uint32(8).int32(message.shortcutId);
    }
    if (message.ip !== "") {
      writer.uint32(18).string(message.ip);
    }
    if (message.referer !== "") {
      writer.uint32(26).string(message.referer);
    }
    if (message.userAgent !== "") {
      writer.uint32(34).string(message.userAgent);
    }
    return writer;
  },

  decode(input: _m0.Reader | Uint8Array, length?: number): ActivityShorcutViewPayload {
    const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseActivityShorcutViewPayload();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 8) {
            break;
          }

          message.shortcutId = reader.int32();
          continue;
        case 2:
          if (tag !== 18) {
            break;
          }

          message.ip = reader.string();
          continue;
        case 3:
          if (tag !== 26) {
            break;
          }

          message.referer = reader.string();
          continue;
        case 4:
          if (tag !== 34) {
            break;
          }

          message.userAgent = reader.string();
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },

  create(base?: DeepPartial<ActivityShorcutViewPayload>): ActivityShorcutViewPayload {
    return ActivityShorcutViewPayload.fromPartial(base ?? {});
  },

  fromPartial(object: DeepPartial<ActivityShorcutViewPayload>): ActivityShorcutViewPayload {
    const message = createBaseActivityShorcutViewPayload();
    message.shortcutId = object.shortcutId ?? 0;
    message.ip = object.ip ?? "";
    message.referer = object.referer ?? "";
    message.userAgent = object.userAgent ?? "";
    return message;
  },
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;

export type DeepPartial<T> = T extends Builtin ? T
  : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>;
